package com.lazycat.backend.controller.shop;

import com.alibaba.fastjson.JSONObject;
import com.lazycat.backend.service.shop.FetchGoodByNameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class FetchGoodByNameController {
    @Autowired
    private FetchGoodByNameService fetchGoodByNameService;

    @PostMapping("shop/fetchGoodByName/")
    public JSONObject fetch(@RequestParam Map<String,String> map) {
        System.out.println(map);
        String type = map.get("good_name");
        return fetchGoodByNameService.fetch(type);
    }
}
